//
//  TAMTBaseNewCell.swift
//  TAMeetApp
//
//  Created by Admin on 2024/12/5.
//

import UIKit

class TAMTBaseNewCell: UICollectionViewCell {
    
    lazy var avatarView:UIImageView = {
        let sub = UIImageView()
        sub.contentMode = .scaleAspectFill
        sub.clipsToBounds = true
        sub.size = CGSizeMake(40, 40)
        sub.layer.cornerRadius = sub.height*0.5
        sub.layer.masksToBounds = true

        return sub
    }()
    
    lazy var nameLabel:UILabel = {
        let sub = UILabel()
        sub.textColor = UIColor(hex: "#999999")
        sub.font = .systemFont(ofSize: 12, weight: .regular)
        sub.height = 17
        return sub
    }()
    
    lazy var sexLabel:UILabel = {
        let sub = UILabel()
        sub.textColor = UIColor(hex: "#ffffff")
        sub.font = .systemFont(ofSize: 11, weight: .regular)
        return sub
    }()
    
    lazy var sexBtn:UIButton = {
        let sub = UIButton(type: .custom)
        sub.titleLabel?.font = .systemFont(ofSize: 11, weight: .regular)
        sub.setBackgroundImage(UIColor(hex: "#F759AB").toImage(size: CGSizeMake(34, 16)), for: .normal)
        sub.setBackgroundImage(UIColor(hex: "#5581FF").toImage(size: CGSizeMake(34, 16)), for: .selected)
        sub.setImage(UIImage(named: "sex_nan"), for: .selected)
        sub.setImage(UIImage(named: "sex_nv"), for: .normal)
        sub.height = 16
        sub.layer.cornerRadius = sub.height*0.5
        sub.layer.masksToBounds = true
        sub.contentHorizontalAlignment = .left
        sub.imageEdgeInsets = UIEdgeInsets(top: 0, left: 4, bottom: 0, right: 0)
        sub.width = 34
        return sub
    }()
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        
        contentView.addSubview(avatarView)
        contentView.addSubview(nameLabel)
        contentView.addSubview(sexBtn)
        sexBtn.addSubview(sexLabel)
        sexLabel.snp.makeConstraints { make in
            make.leading.equalTo(16)
            make.trailing.equalTo(-3)
            make.centerY.equalToSuperview()
        }
    }
    
    @objc var message:TAMTMeeage!  {
        didSet {
            
        }
    }
    
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}
